package org.zdc.pivot.wtk;
import nme.display.Bitmap;
import nme.filesystem.File;
import org.zdc.core.IllegalArgumentException;

class LocalManifest implements IManifest
{
	private var text:String = null;
	private var image:Bitmap = null;
	//private var fileList:Array<File> = null;
	private var values:Hash<Dynamic>;
	
	public function new() 
	{
		values = new Hash<Dynamic>();
	}
	
	public function getText():String {
		return text;
	}
	
	public function putText(txt:String):Void {
		if (text == null) {
			throw new IllegalArgumentException("text is null");
		}
		text = txt;
	}
	
	public function containsText():Bool {
		return text != null;
	}
	
	public function getImage():Bitmap {
		return image;
	}
	
	public function putImage(img:Bitmap):Void {
		if (img == null) {
			throw new IllegalArgumentException("image is null");
		}
		image = img;
	}
	
	public function containsImage():Bool {
		return image == null;
	}
	
	public function getValue(key:String):Dynamic {
		return values.get(key);
	}
	
	public function putValue(key:String, value:Dynamic):Dynamic {
		var prev:Dynamic = null;
		if (values.exists(key)) {
			prev = values.get(key);
		}
		values.set(key, value);
		return prev;
	}
	
	public function containsValue(key:String):Bool {
		return values.exists(key);
	}
}